using System;
using JetBrains.Annotations;

namespace Kaleida.ServiceMonitor.Model.StructuredSource
{
    public class OperationDefinition
    {
        private readonly ActionDefinition requestAction;
        private readonly ActionDefinition handlerAction;

        public OperationDefinition([NotNull] ActionDefinition requestAction, [NotNull] ActionDefinition handlerAction)
        {
            if (requestAction == null) throw new ArgumentNullException("requestAction");
            if (handlerAction == null) throw new ArgumentNullException("handlerAction");

            this.requestAction = requestAction;
            this.handlerAction = handlerAction;
        }

        [NotNull]
        public ActionDefinition RequestAction
        {
            get { return requestAction; }
        }

        [NotNull]
        public ActionDefinition HandlerAction
        {
            get { return handlerAction; }
        }

        public override string ToString()
        {
            return string.Format("Request: {0}\r\nResponse Handler: {1}\r\n", requestAction, handlerAction);
        }
    }
}